package cn.lili.modules.promotion.mapper;

import cn.lili.modules.promotion.entity.dos.BlindboxRuleOrder;
import cn.lili.modules.promotion.entity.dto.BlindboxRuleOrderDTO;
import cn.lili.modules.promotion.entity.vos.BlindboxRuleVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface BlindboxRuleOrderMapper extends BaseMapper<BlindboxRuleOrder> {

    @Select("SELECT\n" +
            "\torders.* \n" +
            "FROM\n" +
            "\tli_blindbox_rule_order as orders\n" +
            "\tleft join li_blindbox_rule_goods as goods on goods.rule_id = orders.rule_id and goods.rule_goods_name = orders.rule_goods_name\n" +
            "where \n" +
            "\tgoods.rule_goods_number <= 50 and orders.create_time >= '2023-10-23'\n" +
            "ORDER BY\n" +
            "\torders.create_time DESC")
    Page<BlindboxRuleOrderDTO> getUpPrizeList(Page<BlindboxRuleVO> page);
}
